package com.wanmait.schedule.controller;


import com.wanmait.schedule.entity.CompanyUser;
import com.wanmait.schedule.entity.Department;
import com.wanmait.schedule.service.PositionService;
import com.wanmait.schedule.util.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 * 职位表 前端控制器
 * </p>
 *
 * @author wanmait
 * @since 2022-03-02
 */
@RestController
@RequestMapping("/position")
public class PositionController {

    @Resource
    private PositionService positionService;
    /*老板提拔职位
    * */
    @GetMapping("leader/initData")
    public Result initData(HttpServletRequest request){
        CompanyUser initCompanyUser =(CompanyUser) request.getAttribute("companyUser");
        Integer companyId = initCompanyUser.getCompanyId();
        List<Department>departments = positionService.initData(companyId);
        return Result.success(departments);
    }
// ----------------------------------------⬆老板功能-------------------------------------------
}
